package server.annotationn;


import cn.hutool.core.lang.Console;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

@Aspect
@Component
@SuppressWarnings("unused")
public class TokenVerityAspect {


    @Pointcut("@annotation(TokenVerity)")
    public void tokenPointCut() {
        Console.log("切入点");
    }

    @Around("tokenPointCut()")
    public void tokenRound(JoinPoint joinPoint){
        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
        Method method = signature.getMethod(); // 获取切入点方法
        Console.log("获取方法",method);
        TokenVerity verity = signature.getMethod().getAnnotation(TokenVerity.class);
        String[] values = verity.value();
        Object[] args = joinPoint.getArgs();
    }

}
